package com.ars.common.servlet;

import com.ars.common.beans.Active.Active;
import com.ars.common.dao.FindActiveInformation;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.TreeMap;

@WebServlet("/findActive")
public class findActive extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("dopost");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("findActiveServletTest");
        //将活动信息发送到查询界面
        TreeMap<Integer, Active> tmap = new TreeMap<Integer,Active>();
        try {
            tmap = new FindActiveInformation().findActive();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        request.setAttribute("actInfo",tmap);
        request.getRequestDispatcher("/indexFace/findActive.jsp").forward(request, response);

    }


}
